#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <vector>
using namespace std;


// 1. https://www.nowcoder.com/profile/200599086/codeBookDetail?submissionId=415659849
class Solution {
public:
    int MoreThanHalfNum_Solution(vector<int> numbers) {
        int count = 1;
        int num = numbers[0];
        for (auto e : numbers)
        {
            if (e != num)
            {
                count--;
            }
            if (count == 0)
            {
                num = e;
                count = 1;
            }
            if (e == num)
            {
                count++;
            }
        }
        return num;
    }
};


// 2. https://www.nowcoder.com/profile/200599086/codeBookDetail?submissionId=419385474
int cmp_int(const void* e1, const void* e2)
{
    return *(int*)e1 - *(int*)e2;
}
int main() {
    int n = 0;
    cin >> n;
    int arr[3 * n];
    for (int i = 0; i < 3 * n; i++)
    {
        cin >> arr[i];
    }
    qsort(arr, 3 * n, 4, cmp_int);
    // for(int i = 0;i<3*n;i++)
    // {
    //     printf("%d ",arr[i]);
    // }
    long long count = 0;
    for (int i = 0; i < n; i++)
    {
        count += arr[3 * n - 2 * (i + 1)];
    }
    cout << count << endl;
}